/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import type.ReceiptStatus;

/**
 *
 * @author wei
 */
@Entity(name="Receipt")
public class ReceiptEntity extends DataObjectEntity implements Serializable {
    private ReceiptStatus status;
    @OneToOne
    private CustomerInvoiceEntity invoice;

    public ReceiptEntity() {
        super();
    }

    public CustomerInvoiceEntity getInvoice() {
        return invoice;
    }

    public void setInvoice(CustomerInvoiceEntity invoice) {
        this.invoice = invoice;
    }

    public ReceiptStatus getStatus() {
        return status;
    }

    public void setStatus(ReceiptStatus status) {
        this.status = status;
    }
    
    public boolean isPosted(){
        return status==ReceiptStatus.posted;
    }

    @Override
    public String childToString() {
        return "ReceiptEntity{" + "status=" + status + ", invoice=" + invoice + '}';
    }
    
}
